
/**
** \file       exec_smpcmd.c
**
** \brief      this function execute simple command rule
**
** \author     Ben M'rad Hanna, Laterem Hamza, Boillot Ulysse et De Olivera
**             Guillaume et Nguyen Viet Dung
**
** \version    1.0
**
** \date       28 Novembre 2010
**
*/

#include "execution.h"

int                     exec_smpcmd(s_smp_cmd           *node)
{
  s_prefix              *tmp_prefix = NULL;
  int                   ret;

  if (node->prefix == NULL && node->elt == NULL)
    return (1);
  else
  {
    if (node->prefix == NULL)
      return (exec_elt(node->elt));
    else
    {
      tmp_prefix = node->prefix;
      while (tmp_prefix != NULL)
      {
        ret = exec_prefix(tmp_prefix);
        if (ret == 1)
          return (1);
      }
      if (node->elt != NULL)
        return (exec_elt(node->elt));

      return (0);
    }
  }
}

